<?php

class View {
    
        private $__errors = '';
        
        private $_title, $_desc, $_keywords;

	function __construct() {
		//echo 'this is the view';
	}

	public function render($name, $noInclude = false)
	{
        Session::init();
        $lang = Session::get('lang');
        if ( $lang == null)
            $lang = 'eng';
        $loc = 'views/'.$lang."/";
		require $loc.'header.php';
                if ($noInclude == true) 
			require 'views/' . $noInclude . '.php';
		require $loc.$name.'.php';
		require $loc.'footer.php';
                
	}
        
        public function getErrors(){
            return $this->__errors;
        }
        
        public function setErrors($errors){
            $this->__errors = $errors;
        }
        
        public function metaData($data){
            if (isset($data['title_seo'])) $this->_title = $data['title_seo'];
            else $this->_title = $data['title'];
            $this->_desc = $data['desc'];
            $this->_keywords = $data['keywords'];
        }
        
        

}